#写一个ttk生成的窗口，有一个entry，一个button，点击button，将entry中的内容当做一个文件复制到当前目录下
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import shutil

class App(tk.Tk):
    def __init__(self):
        super().__init__()
        self.title('请输入目标图片路径')
        self.geometry('300x100')
        self.create_widgets()
    def create_widgets(self):
        self.entry = ttk.Entry(self)
        self.entry.insert(0,r'\\192.168.0.100\Users\Administrator\Desktop\ss\1.jpg')
        # entry 要占满 
        self.entry.pack(fill=tk.X,expand=True)
        self.button = ttk.Button(self,text='copy',command=self.copy)
        self.button.pack()
        self.mainloop()
    def copy(self):
        try:
            s = shutil.copy(self.entry.get(),'D:\myprojects\Python38_10-32\spc\goldenMES/a.jpg')
            messagebox.showerror('复制成功',s)
        except Exception as ex:
            open('log','at',encoding='utf8').write(str(ex))
            messagebox.showerror('复制失败',str(ex))
if __name__ == '__main__':
    app = App()
